﻿using System;
using System.Linq;

namespace Mono.Rift.Core.Graphics
{
	public class ShaderFill : Fill
	{
		public ShaderSet Shaders { get; set; }
		public Texture[] Textures { get; set; }

		public ShaderFill (ShaderSet shaders)
		{
			Shaders = shaders;
		}

		public override void set (PrimitiveTypes prim = PrimitiveTypes.Unknown)
		{
			Shaders.set (prim);
			for (var i = 0; i < Textures.Length; i++)
			{
				if (Textures [i] != null)
				{
					Textures [i].set (i);
				}
			}
		}

		public virtual void setTexture(int i, Texture texture) {
			if (i < 8)
				Textures [i] = texture;
		}
	}
}

